﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Globalization;
using System.Web.Mvc;
using System.Web.Security;

namespace JuniorProject.Models.Applicant
{
    public class ApplicantAppOverviewModel
    {
        #region APPLICATION TABLE
        [DataType(DataType.Text)]
        [Display(Name = "ApplicationID")]
        public int ID { get; set; }

        [DataType(DataType.Text)]
        [Display(Name = "Submission Date")]
        public DateTime AppPostingDate { get; set; }

        [DataType(DataType.Text)]
        [Display(Name = "Application Status")]
        public string Status { get; set; }

        #endregion
        
        #region USER TABLE
        [DataType(DataType.Text)]
        [Display(Name = "UserID")]
        public int UserID { get; set; }

        [DataType(DataType.Text)]
        [Display(Name = "First Name")]
        public string FirstName { get; set; }

        [DataType(DataType.Text)]
        [Display(Name = "Last Name")]
        public string LastName { get; set; }
        #endregion

        #region JOBPOSTINGS TABLE
        [DataType(DataType.Text)]
        [Display(Name = "JobPostingID")]
        public int JobPostingID { get; set; }

        [DataType(DataType.Text)]
        [Display(Name = "Job Title")]
        public string JobTitle { get; set; }

        [DataType(DataType.Text)]
        [Display(Name = "City")]
        public string City { get; set; }

        [DataType(DataType.Text)]
        [Display(Name = "State")]
        public string State { get; set; }

        [DataType(DataType.Text)]
        [Display(Name = "Job Posting Date")]
        public System.DateTime JobPostingDate { get; set; }
        #endregion
        
        public ApplicantAppOverviewModel(Applications Application, Users User,
                                            JobPostings JobPosting)
        {
            this.ID = Application.ID;
            this.AppPostingDate = Application.InsertDate;
            this.Status = Application.Status.Status1;

            this.FirstName = User.FirstName;
            this.LastName = User.LastName;
            this.UserID = User.ID;

            this.City = JobPosting.Locations.City;
            this.State = JobPosting.Locations.State;
            this.JobPostingID = JobPosting.ID;
            this.JobTitle = JobPosting.Jobs.Title;
            this.JobPostingDate = JobPosting.InsertDate;
        }
    }
}